package com.offer;


import com.utils.DataUtils;

import java.util.Comparator;
import java.util.HashSet;
import java.util.PriorityQueue;

public class Test61 {

    public boolean isStraight(int[] nums) {
        HashSet<Integer> hashSet = new HashSet<>();

        int max = 0;
        int min = 13;

        for (int num : nums) {
            if (num == 0) {
                continue;
            }
            if (hashSet.contains(num)) {
                return false;
            }
            hashSet.add(num);
            max = Math.max(num, max);
            min = Math.min(num, min);
        }

        if (max - min < 5) {
            return true;
        } else {
            return false;
        }
    }

    public static void main(String[] args) {
        Test61 test = new Test61();
//        System.out.println(test.isStraight(new int[]{1, 2, 3, 4, 5}));
        System.out.println(test.isStraight(new int[]{0, 0, 8, 5, 4}));
    }

}
